from pydantic import BaseModel, Field
from typing import Optional

class UserScoreCreate(BaseModel):
    """ 用户积分创建 """

    payload_id: str = Field(..., description="用户标识")    
    total_score: int = Field(..., description="总积分")
    used_score: int = Field(..., description="已使用积分")


class UserScoreUpdate(BaseModel):
    """ 用户积分更新 """

    payload_id: str = Field(..., description="用户标识")
    used_score: int = Field(..., description="新增使用的积分（会累加到当前已使用积分）")
    total_score: Optional[int] = Field(None, description="总积分（若为None则保留用户原有总积分）")
